<?php 
class Session {
	/**
	 * 初始化数据
	 * Enter description here ...
	 */
	static protected  function  init(){		
		if(C("memcache_session")){	
			vendor("Memsession",null,".class.php");
			$memcache=new Memcache;
	        $memcache->connect(C("memcache_host"), C("memcache_prot")) or die("could not connect!");	        
	        MemSession::start($memcache);
		}
	}
	/**
	 * 获取session
	 * Enter description here ...
	 * @param unknown_type $key
	 */
	static public function  get($key)
	{
		self::init();	
		return $_SESSION[$key];	  		
	
	}
	/**
	 * 写入session
	 * Enter description here ...
	 * @param unknown_type $name
	 * @param unknown_type $value
	 */
	static public function set($key,$value){
		
		self::init();
		$_SESSION[$key]=$value;
	
	}
	/**
	 * 清除session
	 * Enter description here ...
	 * @param unknown_type $key
	 */
	static public function  clear($key=NULL){
		if ($key==null){
			session_destroy();
		}else {
			unset($_SESSION["$key"]);
		}
	}
}
?>